<ui:composition template="template.xhtml"
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:ui="http://java.sun.com/jsf/facelets">

	<ui:define name="head">
		<link rel="stylesheet" type="text/css"
			href="#{request.contextPath}/stylesheets/login.css" />
			
		<c:if test="#{user.authenticated}">
			<script type="text/javascript">
				//<![CDATA[
				window.onload = function() {
					window.location = "#{request.contextPath}/dashboard";
				};
				//]]>
			</script>
		</c:if>
	</ui:define>

	<ui:define name="content">
		<c:if test="#{not user.authenticated}">
			<div class="LoginPage container">
	
				<c:if test="#{not empty param.error}">
					<div class="alert alert-warning">Your login attempt was
						unsuccessful. Please try again.</div>
					<c:if test="#{not empty param.debug}">
						<div class="alert alert-warning">
							#{SPRING_SECURITY_LAST_EXCEPTION.getClass().simpleName}:
							#{SPRING_SECURITY_LAST_EXCEPTION.message}</div>
					</c:if>
				</c:if>
	
				<form action="j_spring_security_check" method="POST">
					<div class="row">
						<div class="col-xs-12 col-sm-8">
							<div class="panel panel-default">
								<div class="panel-heading">
									<h3>
										Sign in to <span class="blue">DataCleaner</span> <span
											class="orange">monitor</span>
									</h3>
								</div>
								<div class="panel-body">
									<div class="form-group">
										<label for="inputUsername" class="sr-only">Username</label> <input
											name="j_username" type="text" id="inputUsername"
											class="form-control" placeholder="Username"
											required="required" autofocus="autofocus"
											value="#{param['email']}" />
									</div>
	
									<div class="form-group">
										<label for="inputPassword" class="sr-only">Password</label> <input
											name="j_password" type="password" id="inputPassword"
											class="form-control" placeholder="Password"
											required="required" />
									</div>
	
									<div class="checkbox">
										<label> <input type="checkbox" name="rememberMe"
											value="true" /> Remember me
										</label>
									</div>
	
									<input type="hidden" name="r" value="#{param['r']}" />
	
									<button class="btn btn-lg btn-primary btn-block" type="submit">
										<span class="glyphicon glyphicon-log-in" aria-hidden="true" />
										<span>Sign in</span>
									</button>
								</div>
							</div>
						</div>
	
						<c:if test="#{monitorUIPreferences.showDemoAccounts}">
							<div class="col-xs-12 col-sm-4">
								<div class="panel panel-default">
									<div class="panel-heading">Demo accounts</div>
									<div class="panel-body">
										<p>Try logging in using any of these demo credentials:</p>
										<ul>
											<li>admin/admin: The administrator of the 'demo' tenant.</li>
											<li>viewer/viewer: A dashboard viewer of the 'demo' tenant</li>
										</ul>
									</div>
								</div>
							</div>
						</c:if>
					</div>
				</form>
	
			</div>
		</c:if>
	</ui:define>
</ui:composition>